package com.vnaloha.common.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.validator.constraints.NotEmpty;

@Entity
@Table(name = "product")
public class Product {

	@Id
	@Column(name = "id")
	@GeneratedValue
	private Integer id;

	@NotEmpty
	@Column(name = "name")
	private String name;

	@NotEmpty
	@Column(name = "price")
	private Float price;
	
	@NotEmpty
	@Column(name = "quantity")
	private Integer quantity;
	
	@NotEmpty
	@Column(name = "rate")
	private Integer rate;

	@NotEmpty
	@Column(name = "overview")
	private String overview;

	@NotEmpty
	@Column(name = "imagepath")
	private String imagepath;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "category_id")
	private Category category;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "manufacturer_id")
	private Manufacturer manufacturer;

	@OneToMany(mappedBy = "product")
	private List<Offer> offers;

	@OneToMany(mappedBy = "product")
	private List<Rating> ratings;

	@OneToMany(mappedBy = "product")
	private List<Review> reviews;

	@OneToMany(mappedBy = "product")
	private List<OrdersDetail> orderDetails;

	@OneToMany(mappedBy = "product")
	private List<ProductProperty> productProperties;

	@OneToMany(mappedBy = "product")
	private List<Accessory> products;

	@OneToMany(mappedBy = "accessory")
	private List<Accessory> accessories;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Float getPrice() {
		return price;
	}

	public void setPrice(Float price) {
		this.price = price;
	}

	public String getImagepath() {
		return imagepath;
	}

	public void setImagepath(String imagepath) {
		this.imagepath = imagepath;
	}

	public String getOverview() {
		return overview;
	}

	public void setOverview(String overview) {
		this.overview = overview;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public Manufacturer getManufacturer() {
		return manufacturer;
	}

	public void setManufacturer(Manufacturer manufacturer) {
		this.manufacturer = manufacturer;
	}

	public List<Offer> getOffers() {
		return offers;
	}

	public void setOffers(List<Offer> offers) {
		this.offers = offers;
	}

	public List<Rating> getRatings() {
		return ratings;
	}

	public void setRatings(List<Rating> ratings) {
		this.ratings = ratings;
	}

	public List<Review> getReviews() {
		return reviews;
	}

	public void setReviews(List<Review> reviews) {
		this.reviews = reviews;
	}

	public List<OrdersDetail> getOrderDetails() {
		return orderDetails;
	}

	public void setOrderDetails(List<OrdersDetail> orderDetails) {
		this.orderDetails = orderDetails;
	}

	public List<ProductProperty> getProductProperties() {
		return productProperties;
	}

	public void setProductProperties(List<ProductProperty> productProperties) {
		this.productProperties = productProperties;
	}

	public List<Accessory> getAccessories() {
		return accessories;
	}

	public void setAccessories(List<Accessory> accessories) {
		this.accessories = accessories;
	}

	public List<Accessory> getProducts() {
		return products;
	}

	public void setProducts(List<Accessory> products) {
		this.products = products;
	}

	public Integer getQuantity() {
		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	public Integer getRate() {
		return rate;
	}

	public void setRate(Integer rate) {
		this.rate = rate;
	}

}
